<template>
  <div class="active-con">
      <div class="goback" @click="goBack">
        <img src="../../assets/images/goback.png" alt=""/>
      </div>
    <div class="img">
      <img :src="itemData.url" alt="" />
    </div>
    <div class="info">
      <div class="title">{{itemData.title}}</div>
      <div class="desc">{{itemData.desc}}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "ActivePage",
  data(){
    return{
      itemData:{}
    }
  },
  methods:{
      //返回上一级
      goBack(){
          this.$router.go(-1)
      }
  },
  mounted(){

    //刷新
    if(this.$route.params.id){
      const setActive = localStorage.setItem('getActiveData',JSON.stringify(this.$route.params.id)) 
      this.itemData = this.$route.params.id
    }else{
      const getActive = JSON.parse(localStorage.getItem('getActiveData'))
      console.log(getActive);
      this.itemData = getActive
    }
    
    
    
    // this.itemData = this.$route.params.id
    // console.log(this.itemData);

  }
};
</script>

<style lang="less" scoped>
 
.active-con {
    position: relative;
    .goback {
    width: 26px;
    height: 26px;
    margin: 9px 11px 0;
       position: absolute;
    top: 10px;
    left: 10px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .img {
    width: 100%;
    height: 267px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .info {
    padding: 10px;
    .title {
      font-size: 16px;
      font-weight: 600;
      white-space: nowrap;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      overflow: hidden;
      margin-bottom: 10px;
    }
    .desc{
        font-size: 14px;
        text-indent:2em;
    }
  }
}
</style>